<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>医院管理</title>
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/style.css" rel="stylesheet">
    <link href="/css/bootstrap-icons.css" rel="stylesheet">
    <link href="/css/sweetalert2.min.css" rel="stylesheet">
    <style>
        .navbar {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        }
        
        .navbar-brand {
            font-weight: 600;
            color: #4f46e5;
        }
        
        .nav-link {
            color: #4b5563;
            transition: all 0.3s ease;
            padding: 0.5rem 1rem;
            border-radius: 0.5rem;
        }
        
        .nav-link:hover {
            color: #4f46e5;
            background: rgba(79, 70, 229, 0.1);
        }
        
        .nav-link.active {
            color: #4f46e5;
            background: rgba(79, 70, 229, 0.1);
        }
        
        .navbar-toggler {
            border: none;
            padding: 0.5rem;
        }
        
        .navbar-toggler:focus {
            box-shadow: none;
            outline: none;
        }
        
        .dropdown-menu {
            border: none;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            border-radius: 0.5rem;
        }
        
        .dropdown-item {
            padding: 0.5rem 1rem;
            color: #4b5563;
            transition: all 0.3s ease;
        }
        
        .dropdown-item:hover {
            color: #4f46e5;
            background: rgba(79, 70, 229, 0.1);
        }
        
        @media (max-width: 768px) {
            .navbar-nav {
                padding: 1rem 0;
            }
            .nav-link {
                padding: 0.5rem 1rem;
            }
        }
        .summary-card {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            border-radius: 16px;
            border: 1px solid rgba(255, 255, 255, 0.2);
            box-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
            overflow: hidden;
        }
        
        .summary-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 12px 40px rgba(31, 38, 135, 0.25);
        }
        
        .section-title {
            position: relative;
            padding-left: 1rem;
            margin-bottom: 1.5rem;
            font-weight: 600;
            color: #1f2937;
        }
        
        .section-title::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 4px;
            height: 24px;
            background: linear-gradient(to bottom, #6366f1, #4f46e5);
            border-radius: 2px;
        }

        .import-area {
            background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
            border-radius: 12px;
            padding: 2rem;
            margin-bottom: 2rem;
            text-align: center;
            border: 2px dashed #e5e7eb;
            transition: all 0.3s ease;
        }

        .import-area:hover {
            border-color: #6366f1;
            background: linear-gradient(135deg, #ffffff 0%, #f0f1fe 100%);
        }

        .import-icon {
            width: 64px;
            height: 64px;
            margin: 0 auto 1rem;
            background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
            border-radius: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 2rem;
        }

        .import-title {
            font-size: 1.25rem;
            font-weight: 600;
            color: #1f2937;
            margin-bottom: 0.5rem;
        }

        .import-description {
            color: #6b7280;
            margin-bottom: 1.5rem;
        }

        .template-download {
            display: inline-flex;
            align-items: center;
            padding: 0.5rem 1rem;
            background: #f3f4f6;
            border-radius: 8px;
            color: #4f46e5;
            text-decoration: none;
            margin-bottom: 1.5rem;
            transition: all 0.3s ease;
        }

        .template-download:hover {
            background: #e5e7eb;
            color: #4338ca;
        }

        .template-download i {
            margin-right: 0.5rem;
        }

        .file-input {
            display: none;
        }

        .hospital-list {
            margin-top: 2rem;
        }

        .hospital-card {
            background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
            border-radius: 12px;
            padding: 1rem;
            margin-bottom: 1rem;
            border: none;
            transition: all 0.3s ease;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            display: flex;
            justify-content: space-between;
        }

        .hospital-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
        }

        .hospital-name {
            font-weight: 600;
            color: #1f2937;
            margin-bottom: 0.5rem;
        }

        .hospital-id {
            color: #6b7280;
            font-size: 0.875rem;
        }

        .import-time {
            color: #9ca3af;
            font-size: 0.75rem;
            margin-top: 0.5rem;
        }

        .drag-over {
            border-color: #4f46e5;
            background: #f5f3ff;
        }

        @media (max-width: 768px) {
            .import-area {
                padding: 1.5rem;
            }
            
            .import-icon {
                width: 48px;
                height: 48px;
                font-size: 1.5rem;
            }
            
            .import-title {
                font-size: 1.1rem;
            }
            
            .hospital-card {
                padding: 0.75rem;
            }
        }

        .swal2-container {
            z-index: 10000 !important;
        }

        .modal-backdrop {
            z-index: 9999 !important;
        }

        .modal {
            z-index: 10000 !important;
        }
    </style>
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg sticky-top">
        <div class="container">
            <a class="navbar-brand" href="/index">
                <i class="bi bi-clipboard-data me-2"></i>运维年报系统
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <i class="bi bi-list"></i>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav me-auto">
                    <li class="nav-item">
                        <a class="nav-link" href="/index">
                            <i class="bi bi-house me-1"></i>首页
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link active" href="/hospitals/hospital-import">
                            <i class="bi bi-hospital me-1"></i>医院管理
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/report-list">
                            <i class="bi bi-file-text me-1"></i>报告列表
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/yearEndReview">
                            <i class="bi bi-file-text me-1"></i>值班表生成
                        </a>
                    </li>
                </ul>
                <ul class="navbar-nav">
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                            <i class="bi bi-person-circle me-1"></i>
                            <span th:text="${userName}">用户名</span>
                        </a>
                        <ul class="dropdown-menu dropdown-menu-end">
                            <li>
                                <a class="dropdown-item" href="#" onclick="openChangePasswordModal()">
                                    <i class="bi bi-key me-2"></i>修改密码
                                </a>
                            </li>
                            <li><hr class="dropdown-divider"></li>
                            <li>
                                <a class="dropdown-item text-danger" href="/logout">
                                    <i class="bi bi-box-arrow-right me-2"></i>退出登录
                                </a>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <!-- 修改密码模态框 -->
    <div class="modal fade" id="changePasswordModal" tabindex="-1">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">修改密码</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
                </div>
                <div class="modal-body">
                    <div class="mb-3">
                        <label class="form-label">原密码</label>
                        <input type="password" class="form-control" id="oldPassword">
                    </div>
                    <div class="mb-3">
                        <label class="form-label">新密码</label>
                        <input type="password" class="form-control" id="newPassword">
                    </div>
                    <div class="mb-3">
                        <label class="form-label">确认新密码</label>
                        <input type="password" class="form-control" id="confirmPassword">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" onclick="changePassword()">确认修改</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 新增医院模态框 -->
    <div class="modal fade" id="addHospitalModal" tabindex="-1">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">新增医院</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
                </div>
                <div class="modal-body">
                    <div class="mb-3">
                        <label class="form-label">医院名称</label>
                        <input type="text" class="form-control" id="hospitalName">
                    </div>
                    <div class="mb-3">
                        <label class="form-label">医院ID</label>
                        <input type="text" class="form-control" id="hospitalId">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" onclick="addHospital()">确认添加</button>
                </div>
            </div>
        </div>
    </div>

    <div class="page-background bg-hospital"></div>
    <div class="wave-bottom"></div>
    
    <div class="container mt-4">
        <div class="summary-card p-4">
            <div class="section-title">
                <i class="bi bi-hospital me-2"></i>医院列表导入
                <button class="btn btn-primary float-end" onclick="openAddHospitalModal()">
                    <i class="bi bi-plus-circle me-2"></i>新增医院
                </button>
            </div>
            <a href="../excel/医院列表导入.xlsx" class="template-download">
                <i class="bi bi-download"></i>
                下载导入模板
            </a>
            <!-- 导入区域 -->
            <div class="import-area" id="dropZone">
                <div class="import-icon">
                    <i class="bi bi-cloud-upload"></i>
                </div>
                <h3 class="import-title">导入医院列表</h3>
                <p class="import-description">支持 Excel 文件格式 (.xlsx, .xls)</p>
                
                <input type="file" id="fileInput" class="file-input" accept=".xlsx,.xls">
                <div class="mt-3">
                    点击或拖拽文件到此处上传
                </div>
            </div>
            
            <!-- 医院列表 -->
            <div class="hospital-list" id="hospitalList">
                <!-- 列表将通过JavaScript动态加载 -->
            </div>
        </div>
    </div>

    <script src="/js/jquery-3.6.0.min.js"></script>
    <script src="/js/bootstrap.bundle.min.js"></script>
    <script src="/js/sweetalert2.js"></script>
    <script>
        // 修改密码模态框实例
        let changePasswordModal;
        
        // 页面加载完成后初始化
        document.addEventListener('DOMContentLoaded', function() {
            changePasswordModal = new bootstrap.Modal(document.getElementById('changePasswordModal'));
        });

        // 打开修改密码模态框
        function openChangePasswordModal() {
            if (changePasswordModal) {
                changePasswordModal.show();
            }
        }

        function validatePassword(password) {
            const regex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}$/;
            return regex.test(password);
        }

        function changePassword() {
            const oldPassword = document.getElementById('oldPassword').value;
            const newPassword = document.getElementById('newPassword').value;
            const confirmPassword = document.getElementById('confirmPassword').value;

            // 清空输入框
            function clearInputs() {
                document.getElementById('oldPassword').value = '';
                document.getElementById('newPassword').value = '';
                document.getElementById('confirmPassword').value = '';
            }

            // 验证输入
            if (!oldPassword || !newPassword || !confirmPassword) {
                Swal.fire({
                    icon: 'warning',
                    title: '请填写完整',
                    text: '请填写所有密码字段',
                    confirmButtonText: '确定'
                });
                return;
            }

            if (newPassword !== confirmPassword) {
                Swal.fire({
                    icon: 'error',
                    title: '密码不匹配',
                    text: '新密码与确认密码不一致',
                    confirmButtonText: '确定'
                });
                clearInputs();
                return;
            }

            // 验证密码强度
            if (!validatePassword(newPassword)) {
                Swal.fire({
                    icon: 'error',
                    title: '密码强度不足',
                    text: '密码必须包含大小写字母和数字，且长度至少为8位',
                    confirmButtonText: '确定'
                });
                clearInputs();
                return;
            }

            // 显示加载中
            Swal.fire({
                title: '处理中...',
                allowOutsideClick: false,
                allowEscapeKey: false,
                showConfirmButton: false,
                didOpen: () => {
                    Swal.showLoading();
                }
            });

            // 发送修改密码请求
            fetch('/api/user/change-password', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                },
                body: JSON.stringify({
                    oldPassword: oldPassword,
                    newPassword: newPassword
                })
            })
            .then(response => response.json())
            .then(data => {
                if (data.success) {
                    // 关闭修改密码模态框
                    if (changePasswordModal) {
                        changePasswordModal.hide();
                    }
                    
                    // 清空输入
                    clearInputs();
                    
                    // 显示成功消息并跳转
                    Swal.fire({
                        icon: 'success',
                        title: '修改成功',
                        text: '密码已成功修改，请重新登录',
                        allowOutsideClick: false,
                        allowEscapeKey: false,
                        confirmButtonText: '确定'
                    }).then((result) => {
                        if (result.isConfirmed) {
                            window.location.href = '/logout';
                        }
                    });
                } else {
                    Swal.fire({
                        icon: 'error',
                        title: '修改失败',
                        text: data.message || '原密码错误或系统异常，请重试',
                        confirmButtonText: '确定'
                    });
                    clearInputs();
                }
            })
            .catch(error => {
                console.error('Error:', error);
                Swal.fire({
                    icon: 'error',
                    title: '系统错误',
                    text: '发生未知错误，请重试',
                    confirmButtonText: '确定'
                });
                clearInputs();
            });
        }

        document.addEventListener('DOMContentLoaded', function() {
            const dropZone = document.getElementById('dropZone');
            const fileInput = document.getElementById('fileInput');
            const hospitalList = document.getElementById('hospitalList');

            // 加载医院列表
            loadHospitalList();

            // 点击上传区域触发文件选择
            dropZone.addEventListener('click', () => {
                fileInput.click();
            });

            // 处理文件选择
            fileInput.addEventListener('change', handleFileSelect);

            // 处理拖拽
            dropZone.addEventListener('dragover', (e) => {
                e.preventDefault();
                dropZone.classList.add('drag-over');
            });

            dropZone.addEventListener('dragleave', () => {
                dropZone.classList.remove('drag-over');
            });

            dropZone.addEventListener('drop', (e) => {
                e.preventDefault();
                dropZone.classList.remove('drag-over');

                const files = e.dataTransfer.files;
                if (files.length > 0) {
                    handleFile(files[0]);
                }
            });

            function handleFileSelect(e) {
                const file = e.target.files[0];
                if (file) {
                    handleFile(file);
                }
            }

            function handleFile(file) {
                if (!file.name.match(/\.(xlsx|xls)$/)) {
                    Swal.fire({
                        icon: 'error',
                        title: '文件格式错误',
                        text: '请上传 Excel 文件 (.xlsx, .xls)',
                    });
                    return;
                }

                const formData = new FormData();
                formData.append('file', file);

                // 显示上传中提示
                Swal.fire({
                    title: '正在导入...',
                    allowOutsideClick: false,
                    didOpen: () => {
                        Swal.showLoading();
                    }
                });

                fetch('/hospitals/import', {
                    method: 'POST',
                    body: formData
                })
                .then(response => response.json())
                .then(data => {
                    if (data.success) {
                        Swal.fire({
                            icon: 'success',
                            title: '导入成功',
                            text: `成功导入`,
                        });
                        loadHospitalList(); // 重新加载列表
                    } else {
                        throw new Error(data.message || '导入失败');
                    }
                })
                .catch(error => {
                    Swal.fire({
                        icon: 'error',
                        title: '导入失败',
                        text: error.message || '请检查文件格式是否正确',
                    });
                });

                // 清空文件输入框
                fileInput.value = '';
            }

            function loadHospitalList() {
                fetch('/hospitals/list')
                    .then(response => response.json())
                    .then(hospitals => {
                        hospitalList.innerHTML = ''; // 清空现有列表

                        if (hospitals.length === 0) {
                            hospitalList.innerHTML = `
                                <div class="text-center py-4">
                                    <i class="bi bi-inbox text-muted" style="font-size: 2rem;"></i>
                                    <p class="text-muted mt-2">暂无医院数据</p>
                                </div>
                            `;
                            return;
                        }

                        hospitals.forEach(hospital => {
                            const card = document.createElement('div');
                            card.className = 'hospital-card';
                            card.innerHTML = `
                                <div>
                                    <div class="hospital-name">${hospital.hospitalName}</div>
                                    <div class="hospital-id">
                                        <i class="bi bi-hash"></i>
                                        医院id：${hospital.hospitalId}
                                    </div>
                                    <div class="import-time">
                                        <i class="bi bi-clock"></i>
                                        导入时间：${new Date(hospital.createTime).toLocaleString()}
                                    </div>
                                </div>
                                <button style="height: 50px;" class="btn btn-outline-danger btn-sm" onclick="deleteHospital('${hospital.hospitalId}')">
                                    <i class="bi bi-trash me-1"></i>删除
                                </button>
                            `;
                            hospitalList.appendChild(card);
                        });
                    })
                    .catch(error => {
                        console.error('Error loading hospitals:', error);
                        hospitalList.innerHTML = `
                            <div class="text-center py-4">
                                <i class="bi bi-exclamation-circle text-danger" style="font-size: 2rem;"></i>
                                <p class="text-danger mt-2">加载医院列表失败</p>
                            </div>
                        `;
                    });
            }
        });

        // 新增医院模态框实例
        let addHospitalModal;

        // 页面加载完成后初始化
        document.addEventListener('DOMContentLoaded', function() {
            addHospitalModal = new bootstrap.Modal(document.getElementById('addHospitalModal'));
        });

        // 打开新增医院模态框
        function openAddHospitalModal() {
            if (addHospitalModal) {
                addHospitalModal.show();
            }
        }
        const hospitalList = document.getElementById('hospitalList');
        function loadHospitalList() {
            fetch('/hospitals/list')
                .then(response => response.json())
                .then(hospitals => {
                    hospitalList.innerHTML = ''; // 清空现有列表

                    if (hospitals.length === 0) {
                        hospitalList.innerHTML = `
                                <div class="text-center py-4">
                                    <i class="bi bi-inbox text-muted" style="font-size: 2rem;"></i>
                                    <p class="text-muted mt-2">暂无医院数据</p>
                                </div>
                            `;
                        return;
                    }

                    hospitals.forEach(hospital => {
                        const card = document.createElement('div');
                        card.className = 'hospital-card';
                        card.innerHTML = `
                                <div>
                                    <div class="hospital-name">${hospital.hospitalName}</div>
                                    <div class="hospital-id">
                                        <i class="bi bi-hash"></i>
                                        医院id：${hospital.hospitalId}
                                    </div>
                                    <div class="import-time">
                                        <i class="bi bi-clock"></i>
                                        导入时间：${new Date(hospital.createTime).toLocaleString()}
                                    </div>
                                </div>
                                <button style="height: 50px;" class="btn btn-outline-danger btn-sm" onclick="deleteHospital('${hospital.hospitalId}')">
                                    <i class="bi bi-trash me-1"></i>删除
                                </button>
                            `;
                        hospitalList.appendChild(card);
                    });
                })
                .catch(error => {
                    console.error('Error loading hospitals:', error);
                    hospitalList.innerHTML = `
                            <div class="text-center py-4">
                                <i class="bi bi-exclamation-circle text-danger" style="font-size: 2rem;"></i>
                                <p class="text-danger mt-2">加载医院列表失败</p>
                            </div>
                        `;
                });
        }
        // 新增医院
        function addHospital() {
            const hospitalName = document.getElementById('hospitalName').value;
            const hospitalId = document.getElementById('hospitalId').value;

            if (!hospitalName || !hospitalId) {
                Swal.fire({
                    icon: 'warning',
                    title: '请填写完整',
                    text: '请填写医院名称和ID',
                    confirmButtonText: '确定'
                });
                return;
            }

            // 显示加载中
            Swal.fire({
                title: '处理中...',
                allowOutsideClick: false,
                showConfirmButton: false,
                didOpen: () => {
                    Swal.showLoading();
                }
            });

            // 发送新增医院请求
            fetch('/hospitals/add', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                },
                body: JSON.stringify({
                    hospitalName: hospitalName,
                    hospitalId: hospitalId
                })
            })
            .then(response => response.json())
            .then(data => {
                if (data.success) {
                    addHospitalModal.hide();
                    document.getElementById('hospitalName').value = '';
                    document.getElementById('hospitalId').value = '';

                    Swal.fire({
                        icon: 'success',
                        title: '添加成功',
                        text: '医院信息已成功添加',
                        confirmButtonText: '确定'
                    }).then(() => {
                        loadHospitalList(); // 重新加载列表
                    });
                } else {
                    Swal.fire({
                        icon: 'error',
                        title: '添加失败',
                        text: data.message || '添加医院信息失败，请重试',
                        confirmButtonText: '确定'
                    });
                }
            })
            .catch(error => {
                console.error('Error:', error);
                Swal.fire({
                    icon: 'error',
                    title: '系统错误',
                    text: '发生未知错误，请重试',
                    confirmButtonText: '确定'
                });
            });
        }

        // 删除医院
        function deleteHospital(hospitalId) {
            Swal.fire({
                title: '确认删除',
                text: '确定要删除这个医院吗？此操作不可恢复！',
                icon: 'warning',
                showCancelButton: true,
                confirmButtonText: '确定删除',
                cancelButtonText: '取消',
                confirmButtonColor: '#dc3545'
            }).then((result) => {
                if (result.isConfirmed) {
                    // 显示加载中
                    Swal.fire({
                        title: '处理中...',
                        allowOutsideClick: false,
                        showConfirmButton: false,
                        didOpen: () => {
                            Swal.showLoading();
                        }
                    });

                    // 发送删除请求
                    fetch(`/hospitals/delete/${hospitalId}`, {
                        method: 'DELETE'
                    })
                    .then(response => response.json())
                    .then(data => {
                        if (data.success) {
                            Swal.fire({
                                icon: 'success',
                                title: '删除成功',
                                text: '医院信息已成功删除',
                                confirmButtonText: '确定'
                            }).then(() => {
                                loadHospitalList(); // 重新加载列表
                            }); 
                        } else {
                            Swal.fire({
                                icon: 'error',
                                title: '删除失败',
                                text: data.message || '删除医院信息失败，请重试',
                                confirmButtonText: '确定'
                            });
                        }
                    })
                    .catch(error => {
                        console.error('Error:', error);
                        Swal.fire({
                            icon: 'error',
                            title: '系统错误',
                            text: '发生未知错误，请重试',
                            confirmButtonText: '确定'
                        });
                    });
                }
            });
        }

        // 修改显示医院列表的函数
        function displayHospitals(hospitals) {
            const hospitalList = document.getElementById('hospitalList');
            
            if (hospitals.length === 0) {
                hospitalList.innerHTML = `
                    <div class="text-center py-4">
                        <i class="bi bi-inbox text-muted" style="font-size: 2rem;"></i>
                        <p class="text-muted mt-2">暂无医院数据</p>
                    </div>
                `;
                return;
            }
            
            hospitalList.innerHTML = hospitals.map(hospital => `
                <div class="hospital-card">
                    <div class="d-flex justify-content-between align-items-center">
                        <div>
                            <div class="hospital-name">${hospital.hospitalName}</div>
                            <div class="hospital-id">
                                <i class="bi bi-hash"></i>
                                医院id：${hospital.hospitalId}
                            </div>
                            <div class="import-time">
                                <i class="bi bi-clock"></i>
                                导入时间：${new Date(hospital.createTime).toLocaleString()}
                            </div>
                        </div>
                        <button style="height: 50px;" class="btn btn-outline-danger btn-sm" onclick="deleteHospital('${hospital.hospitalId}')">
                            <i class="bi bi-trash me-1"></i>删除
                        </button>
                    </div>
                </div>
            `).join('');
        }
    </script>
</body>
</html> 